
package Model;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import ServicosDAO.ConexaoDAO;

public class Administrador extends Usuario {

	public boolean removerAdministrador(Usuario usuario) {

		String sql = "delete from administrador where id_usuario=?";
		Connection conexao = new ConexaoDAO().getConnection();

		int ok = 0;

		try {

			PreparedStatement stmt = conexao.prepareStatement(sql);

			stmt.setString(1, usuario.getId_usuario());

			ok = stmt.executeUpdate();

			stmt.close();
			conexao.close();

			if (ok == 1) {
				return true;
			}

		} catch (SQLException e) {

			e.printStackTrace();
			throw new RuntimeException();
		}
		return false;
	}
}
